import axios from 'axios';
import ajax from './ajax'

// 1.公共路径
const baseUrl = '/api';

// 2.请求方法，通过挂载的方式导出
// 2.1请求首页轮播图数据
export const getHomeCasual = ()=>ajax(baseUrl + '/api/homecasual');
// 2.2请求首页导航数据
export const getHomeNav = ()=>ajax(baseUrl + '/api/homenav');
// 2.3请求首页商品列表数据
export const getGoodsList = ()=>ajax(baseUrl + '/api/homeshoplist');
// 2.4请求商品推荐页数据
export const getRecommendList = (params)=>ajax(baseUrl + '/api/recommendshoplist',params);
// 2.5获取搜索页商品分类数据
export const getSearchGoods = ()=>ajax(baseUrl + '/api/searchgoods');
// 2.6获取手机验证码
export const getPhoneCode = (phoneNum)=>ajax(baseUrl + '/api/sendCode',{phoneNum});
// 2.7验证手机验证码登录
export const phoneCodeLogin = (phone,code)=>ajax(baseUrl + '/api/login_code',{phone,code},'POST');
// 2.8账户密码登录
export const login = (account,password,code)=>ajax(baseUrl + '/api/login',{account,password,code},'POST');
// 2.9自动登录
export const login_auto = ()=>ajax(baseUrl + '/api/login_auto');
// 2.10退出登录
export const loginout = ()=>ajax(baseUrl + '/api/loginout');
// 2.11修改用户信息
export const alertUserInfo = (params)=>ajax(baseUrl + '/api/change_user_info',params,'POST');
// 2.12加入购物车
export const addShopCart = (id,goods_id,goods_name,thumb_url,price)=>ajax(baseUrl + '/api/add_shop_cart', {
  id,goods_id,goods_name,thumb_url,price
},"POST");
// 2.13获取购物车的数据
export const getCart = ()=>ajax(baseUrl+'/api/get_cart');
